package com.zhs.gccs.http;

import com.zhs.gccs.utils.SharedPrefHelper;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public class TokenInterceptor implements Interceptor {

    @Override
    public Response intercept(Chain chain) throws IOException {
        //config.headers['Authorization'] = 'Bearer ' + getToken()
        Request request = chain.request();
        Request authenticatedRequest = request.newBuilder()
                .header("Authorization", "Bearer " + SharedPrefHelper.getInstance().getToken())
                .build();
        return chain.proceed(authenticatedRequest);
    }
}
